/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N=54;
int main_1042_1()
{
    string initCardDeck[N],shuffledCardDeck[N];
    string cards="SHCD";
    for (int i=0;i<cards.size() ;++i )
    {
        for (int j=1;j<14 ;++j )
        {
            initCardDeck[13*i+j-1]=cards[i]+to_string(j);
        }
    }
    initCardDeck[N-2]="J1",initCardDeck[N-1]="J2";
    int K;
    int order[N]={0};
    scanf("%d",&K);
    for (int i=0;i<N ;++i )
    {
        scanf("%d",&order[i]);
    }
    for (int i=0;i<K ;++i )
    {
        for (int j=0;j<N ;++j )
        {
            shuffledCardDeck[order[j]-1]=initCardDeck[j];
        }
        copy(shuffledCardDeck,shuffledCardDeck+N,initCardDeck);
    }
    for (int k=0;k<(N-1) ;++k )
    {
        printf("%s ",initCardDeck[k].c_str());
    }
    printf("%s",initCardDeck[N-1].c_str());
	return 0;
}
